package cn.gson.crm.control.interesting;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.gson.crm.control.base.BaseServlet;
import cn.gson.crm.model.dao.InterestingDao;

/**
 * Servlet implementation class AddInterestingServlet
 */
@WebServlet("/addinteresting")
public class AddInterestingServlet extends BaseServlet {
	private static final long serialVersionUID = 1L;
	private InterestingDao indao=new InterestingDao();
	@Override
	protected void get(HttpServletRequest request, HttpServletResponse response) throws Exception {
		String interestingName=request.getParameter("interestingName");
		//response.setContentType("text/plain; charset=utf-8");
		if(interestingName!=null&&!interestingName.isEmpty()){
			if (indao.addInteresting(interestingName)) {
				redirect("interesting");
				//forward("source");
			}
		}else {
			request.setAttribute("error", "来源不能为空");
			redirect("interesting");
		}
	}
}
